package main

import (
	"crypto/md5"
	"fmt"
)

func main() {
	s := "sdclonePass"
	s2 := "xytPass"
	s3 := "sdc" + "lonePass"
	fmt.Println(getMD5(s))  //69d890e27d7720af0c4655a773d0d7e7
	fmt.Println(getMD5(s2)) //45bd571cb01d6afa3b57c3d7d60e4ec5
	fmt.Println(getMD5(s3)) //69d890e27d7720af0c4655a773d0d7e7
}

//getMD5 输入一个字符串，输出md5加密的字符串
func getMD5(str string) string {
	sum := md5.Sum([]byte(str))
	md5Str := fmt.Sprintf("%x", sum)
	return md5Str
}
